package com.bang.sgg.controller;

import com.bang.sgg.persist.model.AgentSeat;
import com.bang.sgg.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: Bang
 * @Date: 2019/11/21 17:11
 * @Description:
 */
@RestController
public class HelloController {


    @Autowired
    private HelloService helloService;

    @GetMapping("get/{id}")
    public AgentSeat get(@PathVariable("id") Long id) {
        AgentSeat agentSeat = helloService.get(id);
        return agentSeat;
    }

    @GetMapping("add")
    public AgentSeat add(AgentSeat agentSeat) {

        return helloService.add(agentSeat);
    }

    @GetMapping("update")
    public AgentSeat update(AgentSeat agentSeat) {
        return helloService.update(agentSeat);
    }

    @GetMapping("delete/{id}")
    public int delete(@PathVariable("id") Long id) {
        return helloService.delete(id);
    }

    @GetMapping("/test/{id}")
    private Object test(@PathVariable("id") Long id) {
        return helloService.selectById(id);
    }
}
